﻿namespace WMS6.Web.Administration
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class UserQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlCityOper;
        protected DropDownList ddlCountryOper;
        protected DropDownList ddlDepatrmentOper;
        protected DropDownList ddlEmailOper;
        protected DropDownList ddlFaxOper;
        protected DropDownList ddlIsWhUser;
        protected DropDownList ddlIsWhUserOper;
        protected DropDownList ddlMobileOper;
        protected DropDownList ddlPhoneOper;
        protected DropDownList ddlStateOper;
        protected DropDownList ddlUserIdOper;
        protected DropDownList ddlUserNameOper;
        protected DropDownList ddlZipOper;
        protected HtmlForm F1020;
        protected HtmlInputHidden hdnActionID;
        protected Label lblCity;
        protected Label lblCountry;
        protected Label lblDepatrment;
        protected Label lblEmail;
        protected Label lblFax;
        protected Label lblIsWhUser;
        protected Label lblMobile;
        protected Label lblPhone;
        protected Label lblRole;
        protected Label lblState;
        protected Label lblUserId;
        protected Label lblUserName;
        protected Label lblZip;
        protected HtmlLink mycss;
        protected TextBox txtCity;
        protected TextBox txtCountry;
        protected TextBox txtDepatrment;
        protected TextBox txtEmail;
        protected TextBox txtFax;
        protected TextBox txtMobile;
        protected TextBox txtPhone;
        protected TextBox txtState;
        protected TextBox txtUserId;
        protected TextBox txtUserName;
        protected TextBox txtZip;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("UserList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value)), false);
        }

        private void InitDropDownLists()
        {
            base.InitQueryDDL(this.ddlUserIdOper, 0);
            base.InitQueryDDL(this.ddlUserNameOper, 0);
            base.InitQueryDDL(this.ddlZipOper, 0);
            base.InitQueryDDL(this.ddlStateOper, 0);
            base.InitQueryDDL(this.ddlPhoneOper, 0);
            base.InitQueryDDL(this.ddlMobileOper, 0);
            base.InitQueryDDL(this.ddlFaxOper, 0);
            base.InitQueryDDL(this.ddlEmailOper, 0);
            base.InitQueryDDL(this.ddlDepatrmentOper, 0);
            base.InitQueryDDL(this.ddlCountryOper, 0);
            base.InitQueryDDL(this.ddlCityOper, 0);
            base.InitQueryDDL(this.ddlIsWhUserOper, 0);
            base.InitIsActiveDDL(this.ddlIsWhUser, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.InitDropDownLists();
                this.hdnActionID.Value = base.Request.QueryString["langstyle"];
                if (((base.Request.QueryString["action"] != null) && (base.Request.QueryString["action"] != "")) && ((base.Request.QueryString["action"] == "txtFromUserID") || (base.Request.QueryString["action"] == "txtToUserID")))
                {
                    this.btnSearch_Click(null, null);
                }
            }
        }

        public string City
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCity.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCity.Text.Trim(), this.ddlCityOper.SelectedValue);
                }
                return "";
            }
        }

        public string Country
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCountry.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCountry.Text.Trim(), this.ddlCountryOper.SelectedValue);
                }
                return "";
            }
        }

        public string Depatrment
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDepatrment.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDepatrment.Text.Trim(), this.ddlDepatrmentOper.SelectedValue);
                }
                return "";
            }
        }

        public string Email
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEmail.Text.Trim()))
                {
                    return base.GetParamsString(this.txtEmail.Text.Trim(), this.ddlEmailOper.SelectedValue);
                }
                return "";
            }
        }

        public string Fax
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtFax.Text.Trim()))
                {
                    return base.GetParamsString(this.txtFax.Text.Trim(), this.ddlFaxOper.SelectedValue);
                }
                return "";
            }
        }

        public string IsWhUser
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsWhUser.SelectedValue))
                {
                    return base.GetParamsString(this.ddlIsWhUser.SelectedValue, this.ddlIsWhUserOper.SelectedValue);
                }
                return "";
            }
        }

        public string Mobile
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtMobile.Text.Trim()))
                {
                    return base.GetParamsString(this.txtMobile.Text.Trim(), this.ddlMobileOper.SelectedValue);
                }
                return "";
            }
        }

        public string Phone
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtPhone.Text.Trim()))
                {
                    return base.GetParamsString(this.txtPhone.Text.Trim(), this.ddlPhoneOper.SelectedValue);
                }
                return "";
            }
        }

        public string State
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtState.Text.Trim()))
                {
                    return base.GetParamsString(this.txtState.Text.Trim(), this.ddlStateOper.SelectedValue);
                }
                return "";
            }
        }

        public string UserId
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtUserId.Text.Trim()))
                {
                    return base.GetParamsString(this.txtUserId.Text.Trim(), this.ddlUserIdOper.SelectedValue);
                }
                return "";
            }
        }

        public string UserName
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
                {
                    return base.GetParamsString(this.txtUserName.Text.Trim(), this.ddlUserNameOper.SelectedValue);
                }
                return "";
            }
        }

        public string Zip
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtZip.Text.Trim()))
                {
                    return base.GetParamsString(this.txtZip.Text.Trim(), this.ddlZipOper.SelectedValue);
                }
                return "";
            }
        }
    }
}

